babl, sse2-float: fall back to slow, accurate path for large pow-2.4 inputs
authorEll <ell_se@yahoo.com>
Tue, 7 Nov 2017 20:44:39 +0000 (15:44 -0500)
committerEll <ell_se@yahoo.com>
Tue, 7 Nov 2017 21:07:46 +0000 (16:07 -0500)
commit9aed0e5eb66c57e4352a5bc293d157eadba77abd
treecde077bdc129476e49443395f641f9d22190bc32
parenta4ef3078f5d6ff37052fcbd8b1b8b39a60555bbf
babl, sse2-float: fall back to slow, accurate path for large pow-2.4 inputs

The approximations we use for pow_24() and pow_1_24() diverge from
the actual function for large-enough input values.  This can lead
not just to inaccurate results, but also to infinities and NaNs,
especially when multiple conversions are strung in a row.

When the input value is large enough to produce notable divergence
(the difference between the approximate and actual values is ~1% at
the chosen limits,) fall back to a slower, but more accurate
version.

For the SSE2 float conversions, this results in an increase of ~5%
in conversion time, when all values are below the limit.  When most
values are above the limit, performance can be 10x slower or worse.
babl/base/pow-24.c
babl/base/pow-24.h
extensions/sse2-float.c